package com.jack.vipmis.vip.business.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.google.common.collect.Lists;
import com.jack.vipmis.common.entity.BaseEntity;
import com.jack.vipmis.vip.card.entity.Card;
import com.jack.vipmis.vip.card.entity.Discount;

/**
 * 商家信息
 * 
 * @author JackLiang
 * @date 2014-6-7
 * @version 1.0
 */
@Entity
@Table(name = "business")
public class Business extends BaseEntity<Long> {

	@Column
	private String			bsLogo;

	@Column
	private String			bsName;							// 商家名称

	@ManyToOne(optional = true)
	@JoinColumn(name = "bstype")
	private BusinessType	businessType;

	@Column
	private String			bsAddress;

	@Column
	private String			bsTell;							// 电话

	@Column
	private Double			bsConsume;							// 人均消费

	@Column
	private Float			bsEnvironmental;

	@Column
	private Float			bsEffect;							// 效果

	@Column
	private Float			bsServe;							// 服务

	@Column
	private Long			isGood;

	@Column
	private Long			isBad;

	@Column(name = "gread")
	private Float			bsGread;							// 被打分

	@Column
	private String			bsdistanceX;

	@Column
	private String			bsdistanceY;

	@Column(name = "is_show")
	private Boolean			show;

	@OneToMany(mappedBy = "business", fetch = FetchType.LAZY, cascade = CascadeType.ALL, targetEntity = Discount.class)
	@NotFound(action = NotFoundAction.IGNORE)
	private List<Discount>	discounts	= Lists.newArrayList();

	@OneToMany(mappedBy = "business", fetch = FetchType.LAZY)
	@NotFound(action = NotFoundAction.IGNORE)
	private List<Card>		cards		= Lists.newArrayList();

	// getter setter
	public String getBsName() {
		return bsName;
	}

	public void setBsName(String bsName) {
		this.bsName = bsName;
	}

	public String getBsLogo() {
		return bsLogo;
	}

	public void setBsLogo(String bsLogo) {
		this.bsLogo = bsLogo;
	}

	public BusinessType getBusinessType() {
		return businessType;
	}

	public void setBusinessType(BusinessType businessType) {
		this.businessType = businessType;
	}

	public String getBsAddress() {
		return bsAddress;
	}

	public void setBsAddress(String bsAddress) {
		this.bsAddress = bsAddress;
	}

	public String getBsTell() {
		return bsTell;
	}

	public void setBsTell(String bsTell) {
		this.bsTell = bsTell;
	}

	public Double getBsConsume() {
		return bsConsume;
	}

	public void setBsConsume(Double bsConsume) {
		this.bsConsume = bsConsume;
	}

	public Float getBsEnvironmental() {
		return bsEnvironmental;
	}

	public void setBsEnvironmental(Float bsEnvironmental) {
		this.bsEnvironmental = bsEnvironmental;
	}

	public Long getIsGood() {
		return isGood;
	}

	public void setIsGood(Long isGood) {
		this.isGood = isGood;
	}

	public Long getIsBad() {
		return isBad;
	}

	public void setIsBad(Long isBad) {
		this.isBad = isBad;
	}

	public String getBsdistanceX() {
		return bsdistanceX;
	}

	public void setBsdistanceX(String bsdistanceX) {
		this.bsdistanceX = bsdistanceX;
	}

	public String getBsdistanceY() {
		return bsdistanceY;
	}

	public void setBsdistanceY(String bsdistanceY) {
		this.bsdistanceY = bsdistanceY;
	}

	public Boolean getShow() {
		return show;
	}

	public void setShow(Boolean show) {
		this.show = show;
	}

	public Float getBsEffect() {
		return bsEffect;
	}

	public void setBsEffect(Float bsEffect) {
		this.bsEffect = bsEffect;
	}

	public Float getBsServe() {
		return bsServe;
	}

	public void setBsServe(Float bsServe) {
		this.bsServe = bsServe;
	}

	public Float getBsGread() {
		return bsGread;
	}

	public void setBsGread(Float bsGread) {
		this.bsGread = bsGread;
	}

	public List<Discount> getDiscounts() {
		return discounts;
	}

	public void setDiscounts(List<Discount> discounts) {
		this.discounts = discounts;
	}

	public List<Card> getCards() {
		return cards;
	}

	public void setCards(List<Card> cards) {
		this.cards = cards;
	}

}
